#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e6+7;
struct point 
{
	int cnt=0;
	int id;
}a[N];
bool cmp(point a,point b)
{
	if(a.cnt==b.cnt)return a.id<b.id;
	return a.cnt>b.cnt;
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		for(auto j:s)
		{
			if(j=='o')a[i].cnt++;
		}
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)cout<<a[i].id<<" ";
	return 0;
}
